import { CaseConfigType } from '@shared';
import { BasicComponent } from './basic/basic.component';
import { TypeComponent as MessageTypeComponent } from '../message/type/type.component';
import { CustomizeComponent as MessageCustomizeComponent } from '../message/customize/customize.component';
import { Demo3 as MessageDemo3 } from '../message/demo3/demo3.component';

export const NotificationConfig: CaseConfigType = {
  location: 'Notification',
  description: `用于系统信息或重要的通知提醒。`,
  description_en: `Used for system information or important notification reminders.`,
  component: [
    {
      demo: BasicComponent,
      codePath: 'showcase/notification/basic/basic.component',
      demoTitle: '通知',
      demoTitle_en: 'Notification',
      demoDescription: '通知出现在屏幕右上角。',
      demoDescription_en:
        'The notification appears by default in the lower right corner of the screen and supports the four corner position configurations of the screen.',
    },
    {
      demo: MessageTypeComponent,
      codePath: 'showcase/message/type/type.component',
      demoTitle: '简单使用',
      demoTitle_en: 'Simple',
      demoDescription: '全局提示分为成功、提示、警告、错误共四种类型。',
      demoDescription_en: 'There are four types of global messages: Success, Information, Warning and Error.',
    },
    {
      demo: MessageCustomizeComponent,
      codePath: 'showcase/message/customize/customize.component',
      demoTitle: '自定义',
      demoTitle_en: 'Customize',
      demoDescription: '自定义复杂场景的提示信息。',
      demoDescription_en: 'Customize the prompt message in complex condition.',
    },
    {
      demo: MessageDemo3,
      codePath: 'showcase/message/demo3/demo3.component',
      demoTitle: '更新',
      demoTitle_en: 'Update',
      demoDescription: '更新提示信息。',
      demoDescription_en: 'Update the message property. ',
    },
  ],
  mApi: [
    {
      name: 'Notification Service',
      name_en: 'Notification Service',
      api: [
        {
          attribute: 'create',
          type: 'fn',
          default: '--',
          description: `创建通知提醒框，调用方法：NotificationService.create(options)。`,
          description_en: `Create a notification reminder box and call the method：NotificationService.create(options).`,
        },
        {
          attribute: 'destroy',
          type: 'fn',
          default: '--',
          description: `删除通知提醒框，调用方法：Notification.destroy(id)。当不指定 id 时，将移除所有的通知提醒。参数 id 为创建时输入的 lvNotificationKey。`,
          description_en: `Delete notification reminder box, call method:Notification.destroy(id)。When 'id' is not specified, all global messages will be removed. The parameter 'id' is the lvNotificationKey entered when creating.`,
        },
      ],
    },
    {
      name: 'Notification Options',
      name_en: 'Notification Options',
      api: [
        {
          attribute: 'lvTitle',
          type: 'string',
          default: 'null',
          description: `通知的标题。`,
          description_en: `The title of the notice.`,
        },
        {
          attribute: 'lvZIndex',
          type: 'number',
          default: 'null',
          description: `层级`,
          description_en: `Levels.`,
        },
        {
          attribute: 'lvNotificationKey',
          type: 'string',
          default: '--',
          description: `通知的唯一性标识符。`,
          description_en: `Unique identifier of the notice.`,
        },
        {
          attribute: 'lvIcon',
          type: 'string',
          default: 'null',
          description: `标题前的图标。`,
          description_en: `The icon in front of the title.`,
        },
        {
          attribute: 'lvContent',
          type: 'string | Template',
          default: 'null',
          description: `通知的内容，支持字符串或模板。`,
          description_en: `The content of the notification, supporting strings or templates.`,
        },
        {
          attribute: 'lvWidth',
          type: 'number',
          default: 'null',
          description: `容器的宽度，当不设置时，默认的宽度为 360px。`,
          description_en: `The width of the container, when not set, the default width is 360px.`,
          global: true,
        },
        {
          attribute: 'lvDuration',
          type: 'number',
          default: '0',
          description: `容器持续显示的时间(毫秒)，默认为 0 不自动消失。`,
          description_en: `The time (in milliseconds) that the container continues to display. The default is 0. It does not disappear automatically.`,
          global: true,
        },
        {
          attribute: 'lvKeepShowOnHover',
          type: 'boolean',
          default: 'true',
          description: `鼠标移入容器时，是否持续显示。`,
          description_en: `Whether to continue to display when the mouse is moved into the container.`,
          global: true,
        },
        {
          attribute: 'lvPosition',
          type: 'string',
          default: 'bottomRight',
          description: `容器弹出的位置 ('topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight')。`,
          description_en: `The location where the container pops up ('topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight').`,
          global: true,
        },
        {
          attribute: 'lvOffset',
          type: 'object<{number, number}>',
          default: '{x: 0, y: 0}',
          description: `容器弹出位置的偏移值。`,
          description_en: `The offset value of the container popup position.`,
          global: true,
        },
        {
          attribute: 'lvOnDestroy',
          type: 'fn',
          default: '--',
          description: `通知容器销毁时的回调函数。`,
          description_en: `Callback function when notification container is destroyed.`,
        },
      ],
    },
    {
      name: 'Message Service',
      name_en: 'Message Service',
      api: [
        {
          attribute: 'create',
          type: 'fn',
          default: '--',
          description: `创建全局提示，调用方法：MessageService.create(options)。`,
          description_en: `To create a global message, call method: MessageService.create(options).`,
        },
        {
          attribute: 'info',
          type: 'fn',
          default: '--',
          description: `便捷使用弹出提示信息，调用方法：MessageService.info(lvContent, options?)。注：使用该方法时 options 中 lvType/lvTitle/lvContent 属性无效。`,
          description_en: `It is convenient to use the info message. Call method: MessageService.info(lvContent, options?). Properties lvType/lvTitle/lvContent in options is no valid when using this method.`,
        },
        {
          attribute: 'success',
          type: 'fn',
          default: '--',
          description: `便捷使用弹出成功信息，调用方法：MessageService.success(lvContent, options?)。注：使用该方法时 options 中 lvType/lvTitle/lvContent 属性无效。`,
          description_en: `It is convenient to use the success message. Call method: MessageService.success(lvContent, options?). Properties lvType/lvTitle/lvContent in options is no valid when using this method.`,
        },
        {
          attribute: 'warning',
          type: 'fn',
          default: '--',
          description: `便捷使用弹出警告信息，调用方法：MessageService.warning(lvContent, options?)。注：使用该方法时 options 中 lvType/lvTitle/lvContent 属性无效。`,
          description_en: `It is convenient to use the warning message. Call method: MessageService.warning(lvContent, options?). Properties lvType/lvTitle/lvContent in options is no valid when using this method.`,
        },
        {
          attribute: 'error',
          type: 'fn',
          default: '--',
          description: `便捷使用弹出错误信息，调用方法：MessageService.error(lvContent, options?)。注：使用该方法时 options 中 lvType/lvTitle/lvContent 属性无效。`,
          description_en: `It is convenient to use the error message. Call method: MessageService.error(lvContent, options?). Properties lvType/lvTitle/lvContent in options is no valid when using this method.`,
        },
        {
          attribute: 'destroy',
          type: 'fn',
          default: '--',
          description: `删除全局提示，调用方法：MessageService.destroy(id)， 不指定 id 时，将移除所有的全局提示。参数 id 为创建时输入的 lvMessageKey。`,
          description_en: `Message of global destroy. Call method: MessageService.destroy(id), when 'id' is not specified, all global messages will be removed. The parameter 'id' is the lvMessageKey entered when creating.`,
        },
        {
          attribute: 'update',
          type: 'fn',
          default: '--',
          description: `更新全局提示，调用方法：MessageService.update(id, options?)。参数 id 为创建时输入的 lvMessageKey。`,
          description_en: `Message of global update. Call method: MessageService.destroy(id, options?).`,
        },
      ],
    },
    {
      name: 'Message Options',
      name_en: 'Message Options',
      api: [
        {
          attribute: 'lvMessageKey',
          type: 'string',
          default: '--',
          description: `消息窗的唯一性标识符。`,
          description_en: `Unique identifier of the message.`,
        },
        {
          attribute: 'lvType',
          type: 'string',
          default: 'default',
          description: `信息的类型 ('success' | 'info' | 'warning' | 'error')。`,
          description_en: `Types of messages ('success' | 'info' | 'warning' | 'error')`,
        },
        {
          attribute: 'lvTitle',
          type: 'string',
          default: '--',
          description: `信息的标题。`,
          description_en: `Title of the message`,
        },
        {
          attribute: 'lvContent',
          type: 'string | Template',
          default: '--',
          description: `信息的内容，支持字符串或模板。`,
          description_en: `Content of the message, which supports string or template.`,
        },
        {
          attribute: 'lvRenderType',
          type: '\'html\' | \'text\'',
          default: '\'html\'',
          description: `信息的内容渲染类型，当类容为模板时无效。`,
          description_en: `Content rendering type. This parameter is invalid when the class content is a template.`,
          global: true,
        },
        {
          attribute: 'lvWidth',
          type: 'number | string',
          default: '360',
          description: `容器的宽度，当不设置时，默认的宽度为360px。`,
          description_en: `Width of the container. If lvWidth is not set, default width is 360px.`,
          global: true,
        },
        {
          attribute: 'lvMaxWidth',
          type: 'number | string',
          default: 'auto',
          description: `容器的最大宽度。`,
          description_en: `Maximum width of the container.`,
          global: true,
        },
        {
          attribute: 'lvDuration',
          type: 'number',
          default: '3000',
          description: `消息容器持续显示的时间(毫秒)，当设置为0时不消失。`,
          description_en: `Time (in millisecond) that message container continuously displays. If lvDuration is set to 0, it does not disappear.`,
          global: true,
        },
        {
          attribute: 'lvShowCloseButton',
          type: 'boolean',
          default: 'false',
          description: `是否显示关闭按钮。当lvDuration设置为0时，关闭按钮一定会显示。`,
          description_en: `Whether to display the close button. When lvDuration is set to 0, the close button is always displayed.`,
        },
        {
          attribute: 'lvKeepShowOnHover',
          type: 'boolean',
          default: 'true',
          description: `鼠标移入消息容器时，是否持续显示。`,
          description_en: `Whether to continue to display when the mouse moves into the message container.`,
          global: true,
        },
        {
          attribute: 'lvShowIcon',
          type: 'boolean',
          default: 'true',
          description: `是否显示图标。`,
          description_en: `Whether to display the icon.`,
        },
        {
          attribute: 'lvPosition',
          type: 'string',
          default: 'topCenter',
          description: `容器弹出的位置 ('topLeft' | 'topCenter' | 'topRight')。`,
          description_en: `The location where the container pops up ('topLeft' | 'topCenter' | 'topRight').`,
          global: true,
        },
        {
          attribute: 'lvOffset',
          type: 'object<{number, number}>',
          default: '{x: 0, y: 0}',
          description: `消息容器弹出位置的偏移值。`,
          description_en: `Offset value of the pop-up position of message container`,
          global: true,
        },
        {
          attribute: 'lvContextData',
          type: 'number | string | boolean | Array<any> | { [key: string]: any }',
          default: '-',
          description: `消息内容模板上下文数据。`,
          description_en: `Message content template context data.`,
        },
        {
          attribute: 'lvOnDestroy',
          type: 'fn',
          default: '--',
          description: `消息容器销毁时的回调函数。`,
          description_en: `Callback function when message container is destroyed.`,
        },
        {
          attribute: 'lvOnShow',
          type: 'fn',
          default: '--',
          description: `消息显示时的回调函数。`,
          description_en: `Callback function when message container is show.`,
        },
      ],
    },
    {
      name: '全局配置',
      name_en: 'Global Configuration',
      api: [
        {
          attribute: 'lvMaxStacks',
          type: 'number',
          default: 'notification: 3, message: 5', // TODO 与规范对齐，notification和message的配置是否保持一致
          description: `支持展示的最大队列数。`,
          description_en: `The maximum number of queues supported for display.`,
        },
      ],
    },
  ],
};
